﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonLib {
    public struct Material {
        public Vector3c color;
        public Texture texture;
        public double diffuse, reflection, specular, refrIndex, refraction;
        public double scaleU, scaleV, rscaleU, rscaleV;

        public Material(Vector3c _color, double _diffuse, double _reflection, double _refrIndex) {
            color = _color;
            diffuse = _diffuse;
            reflection = _reflection;
            specular = 1.0 - _diffuse;
            refraction = 1.0 - _reflection;
            refrIndex = _refrIndex;
            texture = null;
            scaleU = scaleV = rscaleU = rscaleV = 1;
        }

        public void setTexture(Texture tex, double u, double v) {
            this.texture = tex;
            setUVScale(u, v);
        }
        public void setUVScale(double u, double v) {
            scaleU = u;
            rscaleU = 1.0 / u;
            scaleV = v;
            rscaleV = 1.0 / v;
        }
    }
}
